package com.vxdata.utils.modules.utils.security;

import io.netty.util.HashedWheelTimer;

import java.util.concurrent.TimeUnit;

/**
 * 延时任务
 */
public class HashedWheelTimerUtil {
    /**
     * 技巧篇：延迟任务处理神器之时间轮 HashedWheelTimer
     * https://learn.lianglianglee.com/%E4%B8%93%E6%A0%8F/Netty%20%E6%A0%B8%E5%BF%83%E5%8E%9F%E7%90%86%E5%89%96%E6%9E%90%E4%B8%8E%20RPC%20%E5%AE%9E%E8%B7%B5-%E5%AE%8C/21%20%20%E6%8A%80%E5%B7%A7%E7%AF%87%EF%BC%9A%E5%BB%B6%E8%BF%9F%E4%BB%BB%E5%8A%A1%E5%A4%84%E7%90%86%E7%A5%9E%E5%99%A8%E4%B9%8B%E6%97%B6%E9%97%B4%E8%BD%AE%20HashedWheelTimer.md
     * <p>
     * 定时任务之HashedWheelTimer
     * https://www.jianshu.com/p/311121f63d2f
     *
     * @param args
     */
    public static void main(String[] args) {
        HashedWheelTimer hashedWheelTimer = new HashedWheelTimer(100, TimeUnit.MILLISECONDS, 256);
        hashedWheelTimer.newTimeout(task -> {
            System.out.println("要执行的任务逻辑");
        }, 10, TimeUnit.SECONDS);

    }
}
